#include<bits/stdc++.h>
using namespace std;
//int a[100001];
int cnt = 0;
#define int long long
void acc(int n){
	int temp = n;
	while(temp){
		if(temp % 10 == 2)
			cnt ++;
		temp /= 10;
	}
}
signed main()
{
	int m,n;
	cin >> m >> n;
	for(int i=m;i<=n;i++){
		acc(i);
	}
	cout << cnt <<endl;
	return 0;
}
